package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.RoadSignMapService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


/**
 * Created by xu-jiaHui on 2017/4/22.
 */
@Controller
@RequestMapping("/rds_RoadSignMap")
public class RoadSignMapController {

    @Resource
    private RoadSignMapService roadSignMapService;

    @RequestMapping(value = "/getRoadPoleCoordinate4Map")
    @ResponseBody
    public JsonMsgDto getRoadPoleCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getRoadPoleCoordinate4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getRoadPoleByXY")
    @ResponseBody
    public JsonMsgDto getRoadPoleByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getRoadPoleByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSolarEnergyInfoByXY")
    @ResponseBody
    public JsonMsgDto getSolarEnergyInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSolarEnergyInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping(value = "/getSignalMachineInfoByXY")
    @ResponseBody
    public JsonMsgDto getSignalMachineInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSignalMachineInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }


    @RequestMapping(value = "/getRoadPoleInfoByXY")
    @ResponseBody
    public JsonMsgDto getRoadPoleInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getRoadPoleInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            e.printStackTrace();
            jsonMsgDto.setIsSuccess(false);
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSolarEnergyCoordinate4Map")
    @ResponseBody
    public JsonMsgDto getSolarEnergyCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSolarEnergyCoordinate4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalMachineCoordinate4Map")
    @ResponseBody
    public JsonMsgDto getSignalMachineCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSignalMachineCoordinate4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalLampCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getSignalLampCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSignalLampCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getMonitorCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getMonitorCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getMonitorCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getCoverCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getCoverCoordinate4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getCoverCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getHighLeverCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getHighLeverCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getHighLeverCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getRoadLineCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getRoadLineCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getRoadLineCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getGuardrailCoordinates4Map")
    @ResponseBody
    public JsonMsgDto getGuardrailCoordinates4Map(Integer orgId, Integer orgType, Integer actorId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getGuardrailCoordinates4Map(orgId, orgType, actorId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getSignalLampInfoByXY")
    @ResponseBody
    public JsonMsgDto getSignalLampInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getSignalLampInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getMonitorInfoByXY")
    @ResponseBody
    public JsonMsgDto getMonitorInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getMonitorInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @RequestMapping("/getCoverInfoByXY")
    @ResponseBody
    public JsonMsgDto getCoverInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getCoverInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @RequestMapping("/getHighLeverInfoByXY")
    @ResponseBody
    public JsonMsgDto getHighLeverInfoByXY(String longitude, String latitude) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getHighLeverInfoByXY(longitude, latitude));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getRoadLineInfoById")
    @ResponseBody
    public JsonMsgDto getRoadLineInfoById(Integer elementId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getRoadLineInfoById(elementId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }

    @RequestMapping("/getGuardrailInfoById")
    @ResponseBody
    public JsonMsgDto getGuardrailInfoById(Integer elementId) throws Exception {
        JsonMsgDto jsonMsgDto = new JsonMsgDto();
        try {
            jsonMsgDto.setJsonData(roadSignMapService.getGuardrailInfoById(elementId));
            jsonMsgDto.setIsSuccess(true);
        } catch (Exception e) {
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


}
